<?php
namespace OpenApi\Controller;
use Think\Controller;
class WarehouseController extends Controller{
	public function _initialize()
	{
		$g=session('company');
		C('erp_dbname',$g['db']);
		$db_name=$g['db'];
		//数据库连接基础配置-begin
		C('db_config.DB_TYPE',C('DB_TYPE'));
		C('db_config.DB_HOST',C('DB_HOST'));
		C('db_config.DB_USER',C('DB_USER'));
		C('db_config.DB_PWD',C('DB_PWD'));
		C('db_config.DB_PORT',C('DB_PORT'));
		C('db_config.DB_CHARSET',C('DB_CHARSET'));
		C('db_config.DB_NAME',C('erp_dbname'));
		//数据库连接基础配置-end

		$base_config=M('Config',C('DB_PREFIX_T'),C('db_config'));//加载配置信息
		$list=$base_config->getField('en_name,value');
		C('base_config',$list);
	}

	//仓库库存列表
	public function get_warehousebound(){
		$param=I('param.','','trim');
		// dump($param);
		// die;
		$warehouse_code=empty($param['warehouse_code'])?0:$param['warehouse_code'];
		$manua_id=empty($param['manua_id'])?0:$param['manua_id'];
		$goods_no=$param['goods_no'];
		$goods_name=$param['goods_name'];
		$bar_code=$param['bar_code'];
		$goods_cate=$param['goods_cate'];
		$status=$param['status'];
		$merchant_code = empty($param['merchant_code'])?0:$param['merchant_code'];

		$data['warehouse_code']=$warehouse_code;
		$data['goods_no']=$goods_no;
		$data['goods_name']=$goods_name;
		$data['bar_code']=$bar_code;
		$data['goods_cate']=$goods_cate;
		$data['merchant_code']=$merchant_code;
		$data['manua_id']=$manua_id;

		$p=$param['p'];
		$rows=20;
		if($status==2){
			$rows=5000;
		}

		$data['page']=$p;
		$data['rows']=$rows;
		$data['sort']='id';
		$data['order']='desc';


		$url=C('BASE_CONFIG.warehousebound');
		$return=push($url,$data);
		echo $return;
	}
}